﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace COFE.Core.Actions
{
    [Work("simple", false)] //Not serializable, because it takes a workAction.
    public class SimpleWork : WorkBase
    {
        protected  SimpleWork(Guid id, string name, string description, Action workAction)
            : base(id, name != null ? name : id.ToString())
        {
            Description = description;
            _workAction = workAction;
        }

        protected SimpleWork(Guid id, string description, Action workAction)
            : this(id, null, description, workAction)
        {        
        }

        public SimpleWork(string description, Action workAction)
            : this(Guid.NewGuid(), description, workAction)
        {            
        }

        public SimpleWork(string name, string description, Action workAction)
            : this(Guid.NewGuid(), name, description, workAction)
        {
        }

        private Action _workAction;

        protected override void DoWork()
        {
            _workAction();
        }
    }
}
